package com.xinke.juc.case03;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author：xinke
 * @Date：2025/9/30
 * @Desc:
 */
@Slf4j
public class TestJoin01 {
    static int r = 0;

    public static void main(String[] args) throws InterruptedException {
        log.info("开始");
        Thread t1 = new Thread(() -> {
            log.info("开始");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            log.info("结束");
            r = 10;
        });
        t1.start();
        // 等待t1线程结束
        t1.join();
        log.info("结果为：{}", r);
        log.info("结束");
    }
}
